package com.yocard.yxyd.ui.presenter;

import com.yocard.yxyd.base.CommonSubscriber;
import com.yocard.yxyd.base.RxPresenter;
import com.yocard.yxyd.http.HttpManager;
import com.yocard.yxyd.http.model.response.UserInfoBean;
import com.yocard.yxyd.ui.contract.CertResultContract;
import com.yocard.yxyd.utils.RxUtil;

import javax.inject.Inject;

/**
 * 验证状态查询
 * Created on 2019/4/8.
 */
public class CertResultPresenter extends RxPresenter<CertResultContract.View> implements CertResultContract.Presenter {
    int headHeight;
    @Inject
    public CertResultPresenter(HttpManager manager) {
        super(manager);
    }

    @Override
    public void fetchUserData() {
        addSubscribe(httpManager.getUswrInfo()
                .compose(RxUtil.rxSchedulerHelper())
                .subscribeWith(new CommonSubscriber<UserInfoBean>(mView) {

                    @Override
                    public void onSuccess(UserInfoBean data) {
                        try {
                            mView.onFetchUser(data);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }));
    }
}
